Swapped out to_string_lossy with display for user facing text#5666
Swapped out to_string_lossy with display for user facing text#5666DOsinga merged 4 commits intoblock:mainfrom
Conversation
| for component in components.iter().skip(len - 2) { | ||
| path_str.push('/'); | ||
| path_str.push_str(component.as_os_str().to_string_lossy().as_ref()); | ||
| path_str.push_str(component.as_os_str().display().as_ref()); |
There was a problem hiding this comment.
displayed in commandline later in line 76
| name, | ||
| source: RecipeSource::Local, | ||
| path: path.to_string_lossy().to_string(), | ||
| path: path.display().to_string(), |
| goose::recipe::template_recipe::parse_recipe_content( | ||
| &rf.content, | ||
| Some(rf.parent_dir.to_string_lossy().to_string()), | ||
| Some(rf.parent_dir.display().to_string()), |
There was a problem hiding this comment.
Used for tracing (printing?) in line 1120
| let search_dirs_str = search_dirs | ||
| .iter() | ||
| .map(|p| p.to_string_lossy()) | ||
| .map(|p| p.display().to_string()) |
There was a problem hiding this comment.
part of error on line 67. Not 100% certain whether errors are consumed by user.
There was a problem hiding this comment.
Pull Request Overview
This PR attempts to replace to_string_lossy() with display() for user-facing path text across multiple files to improve handling of non-UTF-8 paths. However, the implementation introduces compilation errors by calling .display() on OsStr/OsString types which don't have this method.
- Replaces
to_string_lossy()withdisplay()in 6 files - Affects error messages, directory listings, and path formatting
- Changes span across CLI, MCP, and core recipe loading code
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/goose/src/recipe/local_recipes.rs | Updates error message path formatting in recipe file loading |
| crates/goose-mcp/src/developer/text_editor.rs | Changes directory entry name handling |
| crates/goose-cli/src/recipes/search_recipe.rs | Updates path display in recipe listing |
| crates/goose-cli/src/commands/session.rs | Modifies path filtering in session list command |
| crates/goose-cli/src/commands/project.rs | Changes path component formatting in two locations |
| crates/goose-cli/src/cli.rs | Updates recipe parent directory path handling |
Signed-off-by: Vincent Huang <vhuang@squareup.com>
0080343 to
07c2156
Compare
Signed-off-by: Vincent Huang <vhuang@squareup.com>
| let search_dirs_str = search_dirs | ||
| .iter() | ||
| .map(|p| p.to_string_lossy()) | ||
| .map(|p| p.display().to_string()) | ||
| .collect::<Vec<_>>() | ||
| .join(":"); |
There was a problem hiding this comment.
The hardcoded ":" separator on line 68 is incorrect for Windows. The code uses platform-specific separators (';' for Windows, ':' for Unix) when parsing GOOSE_RECIPE_PATH on line 26. Use the same logic here: let path_separator = if cfg!(windows) { ';' } else { ':' }; and then .join(path_separator).
There was a problem hiding this comment.
Don't want to change the scope of this pr (I'm assuming this change will require adding unit tests and normalizing the if cfg!(windows)... logic for reuse), will ignore for now.
There was a problem hiding this comment.
copilot is wrong; this is used interally
* origin/main: (29 commits) chore: Update governance to include Discord (#5690) Ollama improvements (#5609) feat: add Supabase MCP server to registry (#5629) Unlist VS Code extension tutorials from MCP and experimental sections (#5677) fix: make image processing work in github copilot provider (#5687) fix: do not take into account gitignore in developer mcp (#5688) docs: session storage migration (#5682) New maintainers (#5685) chore: Update governance (#5660) chore(release): release version 1.14.0 (minor) (#5676) fix : action icons overlap session title in chat history (#5684) Document recent goose PRs (#5683) docs: add GOOSE_PATH_ROOT environment variable documentation (#5678) feat: SessionManager integration for acp sessions (#5657) teach copilot our CI (#5672) bump openapi version directly (#5674) governance: update MAINTAINERS.md to reflect new maintainers (#5675) chore: upgrade rmcp to 0.8.5 (#5673) Update release instructions (#5662) Swapped out to_string_lossy with display for user facing text (#5666) ...
…5666) Signed-off-by: Vincent Huang <vhuang@squareup.com>
…5666) Signed-off-by: Vincent Huang <vhuang@squareup.com>
…5666) Signed-off-by: Vincent Huang <vhuang@squareup.com> Signed-off-by: Blair Allan <Blairallan@icloud.com>
Summary
Replaced user facing
to_string_lossywithdisplaycalls as recommended per issue hereType of Change
AI Assistance
Testing
N/A
Related Issues
Relates to #5435